import { Map } from "immutable";
import * as actionTypes from "./constants";

const defaultState = Map({
  bannerTop: [],
  personalize: [],
  albumBanners: [],
  topLists: [],
  topUpList: [],
  topNewList: [],
  topOriginList: [],
  singerList: [],
  hotDjprograms: [],
  topListXq: [],
  albumNewestInfo: [],
  myUserInfo: [],
  getCommentInfo: [],
  getNewComments: [],
});

// eslint-disable-next-line import/no-anonymous-default-export
export default (state = defaultState, action) => {
  switch (action.type) {
    case actionTypes.BNNAER_TOP:
      return state.set("bannerTop", action.banner);
    case actionTypes.PERSONALIZED:
      return state.set("personalize", action.personalized);
    case actionTypes.ALBUM_BANNER:
      return state.set("albumBanners", action.albumBanners);
    case actionTypes.TOPLIST:
      return state.set("topLists", action.toplists);
    case actionTypes.TOPUPLIST:
      return state.set("topUpList", action.topUpList);
    case actionTypes.TOPNEWLIST:
      return state.set("topNewList", action.topNewList);
    case actionTypes.TOPORIGINLIST:
      return state.set("topOriginList", action.topOriginList);
    case actionTypes.GETSINGERLISTACTION:
      return state.set("singerList", action.singerList);
    case actionTypes.GETHOTDJPROGRAMACTION:
      return state.set("hotDjprograms", action.hotDjprogramList);
    case actionTypes.TOPLISTXQ:
      return state.set("topListXq", action.toplistXq);
    case actionTypes.GETALBUMNEWEST:
      return state.set("albumNewestInfo", action.albumNewestInfo);
    case actionTypes.MYUSERDETAILINFO:
      return state.set("myUserInfo", action.myUserDetailInfo);
    case actionTypes.GETCOMMENT:
      return state.set("getCommentInfo", action.getCommentInfo);
    case actionTypes.GETNEWCOMMENT:
      return state.set("getNewComments", action.newComments);
    default:
      return state;
  }
};
